<!doctype html>
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
    <title th:text="${title}"></title>
    <link th:unless="${#strings.isEmpty(site.logo)}" rel="preload" th:href="${site.logo}" as="image" />
    <link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
    <script th:inline="javascript">
      window.i18nResources = {
        "jsModule.colorSchemeSwitcher.dark": `[(#{jsModule.colorSchemeSwitcher.dark})]`,
        "jsModule.colorSchemeSwitcher.light": `[(#{jsModule.colorSchemeSwitcher.light})]`,
        "jsModule.colorSchemeSwitcher.auto": `[(#{jsModule.colorSchemeSwitcher.auto})]`,
        "jsModule.share.qzone": `[(#{jsModule.share.qzone})]`,
        "jsModule.share.weibo": `[(#{jsModule.share.weibo})]`,
        "jsModule.share.douban": `[(#{jsModule.share.douban})]`,
        "jsModule.share.wechat": `[(#{jsModule.share.wechat})]`,
        "jsModule.share.native": `[(#{jsModule.share.native})]`,
        "jsModule.share.windowTitle": `[(#{jsModule.share.windowTitle})]`,
        "jsModule.upvote.networkError": `[(#{jsModule.upvote.networkError})]`,
      };
    </script>
    <script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
    <th:block th:if="${head != null}">
      <th:block th:replace="${head}" />
    </th:block>
    <script>
      main.initColorScheme("[[${theme.config.style.color_scheme}]]",[[${theme.config.style.enable_change_color_scheme}]])
    </script>
  </head>
  <body class="bg-slate-50 dark:bg-slate-900">
    <th:block th:replace="~{modules/header}" />
    <th:block th:if="${hero != null}">
      <th:block th:replace="${hero}" />
    </th:block>
    <th:block th:unless="${hero != null}">
      <th:block th:replace="~{modules/hero :: hero(isHome = true, cover = null, title = null)}" />
    </th:block>
    <section
      class="mx-auto mt-6 grid max-w-7xl grid-cols-1 gap-6 px-4 md:grid-cols-[1fr_18rem] lg:px-6"
      th:classappend="${contentClass}"
    >
      <div class="z-0 min-w-0">
        <th:block th:replace="${content}" />
      </div>
      <th:block th:if="${sidebar != null}">
        <th:block th:replace="${sidebar}" />
      </th:block>
      <th:block th:if="${sidebar == null}">
        <th:block th:replace="~{modules/sidebar :: sidebar(prepend = null)}" />
      </th:block>
    </section>
    <th:block th:replace="~{modules/footer}" />
    <th:block th:if="${footer != null}">
      <th:block th:replace="${footer}" />
    </th:block>

    <button
      th:if="${theme.config.global.show_scroll_button}"
      type="button"
      id="btn-scroll-to-top"
      th:aria-label="#{fragment.layout.toTop}"
      class="fixed bottom-5 right-5 flex items-center justify-center rounded-full bg-white p-3 opacity-0 shadow transition-all duration-300 hover:opacity-70 hover:shadow-lg dark:bg-slate-600 lg:bottom-10 lg:right-10"
    >
      <span class="i-tabler-chevron-up text-2xl text-gray-600 dark:text-slate-200"></span>
    </button>
  </body>
</html>
